package com.zlzxm.shoesmarket.view.window.loading;

import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.zlzxm.shoesmarket.R;

/**
 * CREATE BY zlzxm ON 4/9/21
 */
public class WindowLoading extends DialogFragment  {


    private WindowLoading() {
    }

    public static WindowLoading getInstance(){


        return new WindowLoading();
    }


    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {

        Dialog dialog = new Dialog(getContext());

        dialog.setContentView(R.layout.window_loading);

        dialog.setCanceledOnTouchOutside(false);

        Window window = dialog.getWindow();

        window.setBackgroundDrawable(new ColorDrawable(0));

        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);

        window.setLayout(-1,-2 );

        return dialog;
    }
}
